<?php
    $usehtmleditor = can_use_html_editor();

    $text = isset($this->config->text) ? $this->config->text : '';
    if (empty($this->instance->pinned) and $this->instance->pagetype !== 'course-view') {
        $text = clean_text($text, FORMAT_HTML);
    }
?>
<table cellpadding="9" cellspacing="0">
<tr valign="top">
    <td align="right"><?php print_string('configtitle', 'block_selectivehtml'); ?>:</td>
    <td><input type="text" name="title" size="30" value="<?php echo isset($this->config->title)?p($this->config->title):''; ?>" /> (<?php print_string('leaveblanktohide', 'block_selectivehtml'); ?>)</td>
</tr>
<tr valign="top">
    <td align="right"><?php print_string('configrule', 'block_selectivehtml'); ?>:</td>
    <td><select name="rule">
<option value="startswith" <?php if ((isset($this->config->rule)) && ($this->config->rule == "startswith")) { echo 'selected'; } ?>><?php print_string('startswith', 'block_selectivehtml'); ?></option>
<option value="endswith" <?php if ((isset($this->config->rule)) && ($this->config->rule == "endswith")) { echo 'selected'; } ?>><?php print_string('endswith', 'block_selectivehtml'); ?></option>
<option value="contains" <?php if ((isset($this->config->rule)) && ($this->config->rule == "contains")) { echo 'selected'; } ?>><?php print_string('contains', 'block_selectivehtml'); ?></option>
<option value="regex" <?php if ((isset($this->config->rule)) && ($this->config->rule == "regex")) { echo 'selected'; } ?>><?php print_string('regex', 'block_selectivehtml'); ?></option>
</select>
        <td align="right"><?php print_string('configcond', 'block_selectivehtml'); ?>:</td>
    <td><input type="text" name="cond" size="30" value="<?php echo isset($this->config->cond)?p($this->config->cond):''; ?>" /></td>
</tr>
<tr valign="top">
    <td align="right"><?php print_string('configcontent', 'block_selectivehtml'); ?>:</td>
    <td><?php print_textarea($usehtmleditor, 25, 50, 0, 0, 'text', $text) ?></td>
</tr>
<tr>
    <td colspan="3" align="center">
    <input type="submit" value="<?php print_string('savechanges') ?>" /></td>
</tr>
</table>
<?php if ($usehtmleditor) {
          use_html_editor(); 
      }
?>
